home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch1 / ClipCtls.frm (.txt) < prev    next >
Visual Basic Form  |  1999-03-19  |  23KB  |  664 lines

  1. VERSION 5.00
  2. Begin VB.Form frmClipCtls 
  3.    Caption         =   "ClipCtls"
  4.    ClientHeight    =   4515
  5.    ClientLeft      =   600
  6.    ClientTop       =   1365
  7.    ClientWidth     =   8205
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   4515
  11.    ScaleWidth      =   8205
  12.    Begin VB.PictureBox PaintPict 
  13.       ClipControls    =   0   'False
  14.       Height          =   3855
  15.       Index           =   2
  16.       Left            =   5520
  17.       ScaleHeight     =   253
  18.       ScaleMode       =   3  'Pixel
  19.       ScaleWidth      =   173
  20.       TabIndex        =   6
  21.       Top             =   240
  22.       Width           =   2655
  23.       Begin VB.TextBox txtObscures 
  24.          Alignment       =   2  'Center
  25.          BeginProperty Font 
  26.             Name            =   "MS Sans Serif"
  27.             Size            =   9.75
  28.             Charset         =   0
  29.             Weight          =   700
  30.             Underline       =   0   'False
  31.             Italic          =   0   'False
  32.             Strikethrough   =   0   'False
  33.          EndProperty
  34.          Height          =   345
  35.          Index           =   8
  36.          Left            =   240
  37.          TabIndex        =   28
  38.          Text            =   "TextBox"
  39.          Top             =   1440
  40.          Width           =   975
  41.       End
  42.       Begin VB.TextBox txtObscures 
  43.          Alignment       =   2  'Center
  44.          BeginProperty Font 
  45.             Name            =   "MS Sans Serif"
  46.             Size            =   9.75
  47.             Charset         =   0
  48.             Weight          =   700
  49.             Underline       =   0   'False
  50.             Italic          =   0   'False
  51.             Strikethrough   =   0   'False
  52.          EndProperty
  53.          Height          =   345
  54.          Index           =   9
  55.          Left            =   1440
  56.          TabIndex        =   27
  57.          Text            =   "TextBox"
  58.          Top             =   1440
  59.          Width           =   975
  60.       End
  61.       Begin VB.TextBox txtObscures 
  62.          Alignment       =   2  'Center
  63.          BeginProperty Font 
  64.             Name            =   "MS Sans Serif"
  65.             Size            =   9.75
  66.             Charset         =   0
  67.             Weight          =   700
  68.             Underline       =   0   'False
  69.             Italic          =   0   'False
  70.             Strikethrough   =   0   'False
  71.          EndProperty
  72.          Height          =   345
  73.          Index           =   10
  74.          Left            =   240
  75.          TabIndex        =   26
  76.          Text            =   "TextBox"
  77.          Top             =   2040
  78.          Width           =   975
  79.       End
  80.       Begin VB.TextBox txtObscures 
  81.          Alignment       =   2  'Center
  82.          BeginProperty Font 
  83.             Name            =   "MS Sans Serif"
  84.             Size            =   9.75
  85.             Charset         =   0
  86.             Weight          =   700
  87.             Underline       =   0   'False
  88.             Italic          =   0   'False
  89.             Strikethrough   =   0   'False
  90.          EndProperty
  91.          Height          =   345
  92.          Index           =   11
  93.          Left            =   1440
  94.          TabIndex        =   25
  95.          Text            =   "TextBox"
  96.          Top             =   2040
  97.          Width           =   975
  98.       End
  99.       Begin VB.Image imgObscures 
  100.          Height          =   960
  101.          Index           =   4
  102.          Left            =   240
  103.          Picture         =   "ClipCtls.frx":0000
  104.          Top             =   2640
  105.          Width           =   960
  106.       End
  107.       Begin VB.Label lblObscuring 
  108.          Alignment       =   2  'Center
  109.          BorderStyle     =   1  'Fixed Single
  110.          Caption         =   "Label"
  111.          BeginProperty Font 
  112.             Name            =   "MS Sans Serif"
  113.             Size            =   9.75
  114.             Charset         =   0
  115.             Weight          =   700
  116.             Underline       =   0   'False
  117.             Italic          =   0   'False
  118.             Strikethrough   =   0   'False
  119.          EndProperty
  120.          Height          =   345
  121.          Index           =   8
  122.          Left            =   240
  123.          TabIndex        =   32
  124.          Top             =   240
  125.          Width           =   975
  126.       End
  127.       Begin VB.Label lblObscuring 
  128.          Alignment       =   2  'Center
  129.          BorderStyle     =   1  'Fixed Single
  130.          Caption         =   "Label"
  131.          BeginProperty Font 
  132.             Name            =   "MS Sans Serif"
  133.             Size            =   9.75
  134.             Charset         =   0
  135.             Weight          =   700
  136.             Underline       =   0   'False
  137.             Italic          =   0   'False
  138.             Strikethrough   =   0   'False
  139.          EndProperty
  140.          Height          =   345
  141.          Index           =   9
  142.          Left            =   1440
  143.          TabIndex        =   31
  144.          Top             =   240
  145.          Width           =   975
  146.       End
  147.       Begin VB.Label lblObscuring 
  148.          Alignment       =   2  'Center
  149.          BorderStyle     =   1  'Fixed Single
  150.          Caption         =   "Label"
  151.          BeginProperty Font 
  152.             Name            =   "MS Sans Serif"
  153.             Size            =   9.75
  154.             Charset         =   0
  155.             Weight          =   700
  156.             Underline       =   0   'False
  157.             Italic          =   0   'False
  158.             Strikethrough   =   0   'False
  159.          EndProperty
  160.          Height          =   345
  161.          Index           =   10
  162.          Left            =   240
  163.          TabIndex        =   30
  164.          Top             =   840
  165.          Width           =   975
  166.       End
  167.       Begin VB.Label lblObscuring 
  168.          Alignment       =   2  'Center
  169.          BorderStyle     =   1  'Fixed Single
  170.          Caption         =   "Label"
  171.          BeginProperty Font 
  172.             Name            =   "MS Sans Serif"
  173.             Size            =   9.75
  174.             Charset         =   0
  175.             Weight          =   700
  176.             Underline       =   0   'False
  177.             Italic          =   0   'False
  178.             Strikethrough   =   0   'False
  179.          EndProperty
  180.          Height          =   345
  181.          Index           =   11
  182.          Left            =   1440
  183.          TabIndex        =   29
  184.          Top             =   840
  185.          Width           =   975
  186.       End
  187.       Begin VB.Image imgObscures 
  188.          Height          =   960
  189.          Index           =   5
  190.          Left            =   1440
  191.          Picture         =   "ClipCtls.frx":0882
  192.          Top             =   2640
  193.          Width           =   960
  194.       End
  195.    End
  196.    Begin VB.PictureBox PaintPict 
  197.       ClipControls    =   0   'False
  198.       Height          =   3855
  199.       Index           =   1
  200.       Left            =   2760
  201.       ScaleHeight     =   253
  202.       ScaleMode       =   3  'Pixel
  203.       ScaleWidth      =   173
  204.       TabIndex        =   4
  205.       Top             =   240
  206.       Width           =   2655
  207.       Begin VB.TextBox txtObscures 
  208.          Alignment       =   2  'Center
  209.          BeginProperty Font 
  210.             Name            =   "MS Sans Serif"
  211.             Size            =   9.75
  212.             Charset         =   0
  213.             Weight          =   700
  214.             Underline       =   0   'False
  215.             Italic          =   0   'False
  216.             Strikethrough   =   0   'False
  217.          EndProperty
  218.          Height          =   345
  219.          Index           =   7
  220.          Left            =   1440
  221.          TabIndex        =   24
  222.          Text            =   "TextBox"
  223.          Top             =   2040
  224.          Width           =   975
  225.       End
  226.       Begin VB.TextBox txtObscures 
  227.          Alignment       =   2  'Center
  228.          BeginProperty Font 
  229.             Name            =   "MS Sans Serif"
  230.             Size            =   9.75
  231.             Charset         =   0
  232.             Weight          =   700
  233.             Underline       =   0   'False
  234.             Italic          =   0   'False
  235.             Strikethrough   =   0   'False
  236.          EndProperty
  237.          Height          =   345
  238.          Index           =   6
  239.          Left            =   240
  240.          TabIndex        =   23
  241.          Text            =   "TextBox"
  242.          Top             =   2040
  243.          Width           =   975
  244.       End
  245.       Begin VB.TextBox txtObscures 
  246.          Alignment       =   2  'Center
  247.          BeginProperty Font 
  248.             Name            =   "MS Sans Serif"
  249.             Size            =   9.75
  250.             Charset         =   0
  251.             Weight          =   700
  252.             Underline       =   0   'False
  253.             Italic          =   0   'False
  254.             Strikethrough   =   0   'False
  255.          EndProperty
  256.          Height          =   345
  257.          Index           =   5
  258.          Left            =   1440
  259.          TabIndex        =   22
  260.          Text            =   "TextBox"
  261.          Top             =   1440
  262.          Width           =   975
  263.       End
  264.       Begin VB.TextBox txtObscures 
  265.          Alignment       =   2  'Center
  266.          BeginProperty Font 
  267.             Name            =   "MS Sans Serif"
  268.             Size            =   9.75
  269.             Charset         =   0
  270.             Weight          =   700
  271.             Underline       =   0   'False
  272.             Italic          =   0   'False
  273.             Strikethrough   =   0   'False
  274.          EndProperty
  275.          Height          =   345
  276.          Index           =   4
  277.          Left            =   240
  278.          TabIndex        =   17
  279.          Text            =   "TextBox"
  280.          Top             =   1440
  281.          Width           =   975
  282.       End
  283.       Begin VB.Image imgObscures 
  284.          Height          =   960
  285.          Index           =   3
  286.          Left            =   1440
  287.          Picture         =   "ClipCtls.frx":1104
  288.          Top             =   2640
  289.          Width           =   960
  290.       End
  291.       Begin VB.Label lblObscuring 
  292.          Alignment       =   2  'Center
  293.          BorderStyle     =   1  'Fixed Single
  294.          Caption         =   "Label"
  295.          BeginProperty Font 
  296.             Name            =   "MS Sans Serif"
  297.             Size            =   9.75
  298.             Charset         =   0
  299.             Weight          =   700
  300.             Underline       =   0   'False
  301.             Italic          =   0   'False
  302.             Strikethrough   =   0   'False
  303.          EndProperty
  304.          Height          =   345
  305.          Index           =   7
  306.          Left            =   1440
  307.          TabIndex        =   21
  308.          Top             =   840
  309.          Width           =   975
  310.       End
  311.       Begin VB.Label lblObscuring 
  312.          Alignment       =   2  'Center
  313.          BorderStyle     =   1  'Fixed Single
  314.          Caption         =   "Label"
  315.          BeginProperty Font 
  316.             Name            =   "MS Sans Serif"
  317.             Size            =   9.75
  318.             Charset         =   0
  319.             Weight          =   700
  320.             Underline       =   0   'False
  321.             Italic          =   0   'False
  322.             Strikethrough   =   0   'False
  323.          EndProperty
  324.          Height          =   345
  325.          Index           =   6
  326.          Left            =   240
  327.          TabIndex        =   20
  328.          Top             =   840
  329.          Width           =   975
  330.       End
  331.       Begin VB.Label lblObscuring 
  332.          Alignment       =   2  'Center
  333.          BorderStyle     =   1  'Fixed Single
  334.          Caption         =   "Label"
  335.          BeginProperty Font 
  336.             Name            =   "MS Sans Serif"
  337.             Size            =   9.75
  338.             Charset         =   0
  339.             Weight          =   700
  340.             Underline       =   0   'False
  341.             Italic          =   0   'False
  342.             Strikethrough   =   0   'False
  343.          EndProperty
  344.          Height          =   345
  345.          Index           =   5
  346.          Left            =   1440
  347.          TabIndex        =   19
  348.          Top             =   240
  349.          Width           =   975
  350.       End
  351.       Begin VB.Label lblObscuring 
  352.          Alignment       =   2  'Center
  353.          BorderStyle     =   1  'Fixed Single
  354.          Caption         =   "Label"
  355.          BeginProperty Font 
  356.             Name            =   "MS Sans Serif"
  357.             Size            =   9.75
  358.             Charset         =   0
  359.             Weight          =   700
  360.             Underline       =   0   'False
  361.             Italic          =   0   'False
  362.             Strikethrough   =   0   'False
  363.          EndProperty
  364.          Height          =   345
  365.          Index           =   4
  366.          Left            =   240
  367.          TabIndex        =   18
  368.          Top             =   240
  369.          Width           =   975
  370.       End
  371.       Begin VB.Image imgObscures 
  372.          Height          =   960
  373.          Index           =   2
  374.          Left            =   240
  375.          Picture         =   "ClipCtls.frx":1986
  376.          Top             =   2640
  377.          Width           =   960
  378.       End
  379.    End
  380.    Begin VB.PictureBox PaintPict 
  381.       Height          =   3855
  382.       Index           =   0
  383.       Left            =   0
  384.       ScaleHeight     =   253
  385.       ScaleMode       =   3  'Pixel
  386.       ScaleWidth      =   173
  387.       TabIndex        =   0
  388.       Top             =   240
  389.       Width           =   2655
  390.       Begin VB.TextBox txtObscures 
  391.          Alignment       =   2  'Center
  392.          BeginProperty Font 
  393.             Name            =   "MS Sans Serif"
  394.             Size            =   9.75
  395.             Charset         =   0
  396.             Weight          =   700
  397.             Underline       =   0   'False
  398.             Italic          =   0   'False
  399.             Strikethrough   =   0   'False
  400.          EndProperty
  401.          Height          =   345
  402.          Index           =   3
  403.          Left            =   1440
  404.          TabIndex        =   16
  405.          Text            =   "TextBox"
  406.          Top             =   2040
  407.          Width           =   975
  408.       End
  409.       Begin VB.TextBox txtObscures 
  410.          Alignment       =   2  'Center
  411.          BeginProperty Font 
  412.             Name            =   "MS Sans Serif"
  413.             Size            =   9.75
  414.             Charset         =   0
  415.             Weight          =   700
  416.             Underline       =   0   'False
  417.             Italic          =   0   'False
  418.             Strikethrough   =   0   'False
  419.          EndProperty
  420.          Height          =   345
  421.          Index           =   2
  422.          Left            =   240
  423.          TabIndex        =   15
  424.          Text            =   "TextBox"
  425.          Top             =   2040
  426.          Width           =   975
  427.       End
  428.       Begin VB.TextBox txtObscures 
  429.          Alignment       =   2  'Center
  430.          BeginProperty Font 
  431.             Name            =   "MS Sans Serif"
  432.             Size            =   9.75
  433.             Charset         =   0
  434.             Weight          =   700
  435.             Underline       =   0   'False
  436.             Italic          =   0   'False
  437.             Strikethrough   =   0   'False
  438.          EndProperty
  439.          Height          =   345
  440.          Index           =   1
  441.          Left            =   1440
  442.          TabIndex        =   14
  443.          Text            =   "TextBox"
  444.          Top             =   1440
  445.          Width           =   975
  446.       End
  447.       Begin VB.TextBox txtObscures 
  448.          Alignment       =   2  'Center
  449.          BeginProperty Font 
  450.             Name            =   "MS Sans Serif"
  451.             Size            =   9.75
  452.             Charset         =   0
  453.             Weight          =   700
  454.             Underline       =   0   'False
  455.             Italic          =   0   'False
  456.             Strikethrough   =   0   'False
  457.          EndProperty
  458.          Height          =   345
  459.          Index           =   0
  460.          Left            =   240
  461.          TabIndex        =   3
  462.          Text            =   "TextBox"
  463.          Top             =   1440
  464.          Width           =   975
  465.       End
  466.       Begin VB.Image imgObscures 
  467.          Height          =   960
  468.          Index           =   1
  469.          Left            =   1440
  470.          Picture         =   "ClipCtls.frx":2208
  471.          Top             =   2640
  472.          Width           =   960
  473.       End
  474.       Begin VB.Label lblObscuring 
  475.          Alignment       =   2  'Center
  476.          BorderStyle     =   1  'Fixed Single
  477.          Caption         =   "Label"
  478.          BeginProperty Font 
  479.             Name            =   "MS Sans Serif"
  480.             Size            =   9.75
  481.             Charset         =   0
  482.             Weight          =   700
  483.             Underline       =   0   'False
  484.             Italic          =   0   'False
  485.             Strikethrough   =   0   'False
  486.          EndProperty
  487.          Height          =   345
  488.          Index           =   3
  489.          Left            =   1440
  490.          TabIndex        =   13
  491.          Top             =   840
  492.          Width           =   975
  493.       End
  494.       Begin VB.Label lblObscuring 
  495.          Alignment       =   2  'Center
  496.          BorderStyle     =   1  'Fixed Single
  497.          Caption         =   "Label"
  498.          BeginProperty Font 
  499.             Name            =   "MS Sans Serif"
  500.             Size            =   9.75
  501.             Charset         =   0
  502.             Weight          =   700
  503.             Underline       =   0   'False
  504.             Italic          =   0   'False
  505.             Strikethrough   =   0   'False
  506.          EndProperty
  507.          Height          =   345
  508.          Index           =   2
  509.          Left            =   240
  510.          TabIndex        =   12
  511.          Top             =   840
  512.          Width           =   975
  513.       End
  514.       Begin VB.Label lblObscuring 
  515.          Alignment       =   2  'Center
  516.          BorderStyle     =   1  'Fixed Single
  517.          Caption         =   "Label"
  518.          BeginProperty Font 
  519.             Name            =   "MS Sans Serif"
  520.             Size            =   9.75
  521.             Charset         =   0
  522.             Weight          =   700
  523.             Underline       =   0   'False
  524.             Italic          =   0   'False
  525.             Strikethrough   =   0   'False
  526.          EndProperty
  527.          Height          =   345
  528.          Index           =   1
  529.          Left            =   1440
  530.          TabIndex        =   11
  531.          Top             =   360
  532.          Width           =   975
  533.       End
  534.       Begin VB.Image imgObscures 
  535.          Height          =   960
  536.          Index           =   0
  537.          Left            =   240
  538.          Picture         =   "ClipCtls.frx":2A8A
  539.          Top             =   2640
  540.          Width           =   960
  541.       End
  542.       Begin VB.Label lblObscuring 
  543.          Alignment       =   2  'Center
  544.          BorderStyle     =   1  'Fixed Single
  545.          Caption         =   "Label"
  546.          BeginProperty Font 
  547.             Name            =   "MS Sans Serif"
  548.             Size            =   9.75
  549.             Charset         =   0
  550.             Weight          =   700
  551.             Underline       =   0   'False
  552.             Italic          =   0   'False
  553.             Strikethrough   =   0   'False
  554.          EndProperty
  555.          Height          =   345
  556.          Index           =   0
  557.          Left            =   240
  558.          TabIndex        =   2
  559.          Top             =   360
  560.          Width           =   975
  561.       End
  562.    End
  563.    Begin VB.Label lblTime 
  564.       Alignment       =   2  'Center
  565.       Height          =   255
  566.       Index           =   2
  567.       Left            =   5520
  568.       TabIndex        =   10
  569.       Top             =   4200
  570.       Width           =   2655
  571.    End
  572.    Begin VB.Label lblTime 
  573.       Alignment       =   2  'Center
  574.       Height          =   255
  575.       Index           =   1
  576.       Left            =   2760
  577.       TabIndex        =   9
  578.       Top             =   4200
  579.       Width           =   2655
  580.    End
  581.    Begin VB.Label lblTime 
  582.       Alignment       =   2  'Center
  583.       Height          =   255
  584.       Index           =   0
  585.       Left            =   0
  586.       TabIndex        =   8
  587.       Top             =   4200
  588.       Width           =   2655
  589.    End
  590.    Begin VB.Label Label1 
  591.       Alignment       =   2  'Center
  592.       Caption         =   "ClipControls = False (manual refresh)"
  593.       Height          =   255
  594.       Index           =   2
  595.       Left            =   5520
  596.       TabIndex        =   7
  597.       Top             =   0
  598.       Width           =   2655
  599.    End
  600.    Begin VB.Label Label1 
  601.       Alignment       =   2  'Center
  602.       Caption         =   "ClipControls = False"
  603.       Height          =   255
  604.       Index           =   1
  605.       Left            =   2760
  606.       TabIndex        =   5
  607.       Top             =   0
  608.       Width           =   2655
  609.    End
  610.    Begin VB.Label Label1 
  611.       Alignment       =   2  'Center
  612.       Caption         =   "ClipControls = True"
  613.       Height          =   255
  614.       Index           =   0
  615.       Left            =   0
  616.       TabIndex        =   1
  617.       Top             =   0
  618.       Width           =   2655
  619.    End
  620. Attribute VB_Name = "frmClipCtls"
  621. Attribute VB_GlobalNameSpace = False
  622. Attribute VB_Creatable = False
  623. Attribute VB_PredeclaredId = True
  624. Attribute VB_Exposed = False
  625. Option Explicit
  626. ' Draw a bunch of squiggly lines.
  627. Private Sub DrawPict(pic As PictureBox)
  628. Const Amp = 3
  629. Const PI = 3.14159
  630. Const Per = 4 * PI
  631. Dim i As Single
  632. Dim j As Single
  633. Dim hgt As Single
  634. Dim wid As Single
  635.     pic.ScaleMode = 3   ' Pixel.
  636.     pic.Cls     ' Clear the picture box.
  637.     For i = 0 To pic.ScaleHeight Step 4
  638.         pic.CurrentX = 0
  639.         pic.CurrentY = i
  640.         For j = 0 To pic.ScaleWidth
  641.             pic.Line -(j, i + Amp * Sin(j / Per))
  642.         Next j
  643.     Next i
  644.     For i = 1 To hgt Step 2
  645.         pic.Line (0, i)-(wid, i)
  646.     Next i
  647. End Sub
  648. ' Redraw this PictureBox.
  649. Private Sub PaintPict_Paint(Index As Integer)
  650. Dim start_time As Single
  651. Dim i As Integer
  652.     start_time = Timer
  653.     DrawPict PaintPict(Index)
  654.     ' Manually refresh txtObscures(8) through txtObscures(11).
  655.     If Index = 2 Then
  656.         For i = 8 To 11
  657.             txtObscures(i).Refresh
  658.         Next i
  659.     End If
  660.     lblTime(Index).Caption = _
  661.         Format$(Timer - start_time, "0.00") & _
  662.         " seconds"
  663. End Sub
  664.